import request from "./useRequests";
import { userinfo } from '@/stores/counter'

export default function downloadFile() {
    const user = userinfo()
    async function download(id: string) {
        try {
            const res = await request({
                method: "get",
                url: `/file/download`,
                params: {
                    "id": id,
                },
                responseType: 'blob'
            })
            return res.data
        } catch (err: any) {
            //alert(err)
        }
    }

    return {
        download
    }
}